package SFRZ;

import java.security.KeyPair;
import java.security.PrivateKey;

/**
 * @author konley
 * @date 2021-12-11 11:48
 */
public class Test {
    public static void main(String[] args) throws Exception {
        SenderA senderA = new SenderA();
        ReceiverB receiverB = new ReceiverB();
        //A发送签名给B
        String y = senderA.send();
        System.out.println("--------------------------");
        System.out.println("数字签名："+y);
        //取得A的公钥
        String puk = senderA.getPuk();
        //取得A的明文
        String m = senderA.getM();
        //验签
        boolean result = receiverB.decrypt(m,y,puk);
        if(result){
            System.out.println("验证成功，明文为："+m);
        }else{
            System.out.println("验证失败");
        }
    }
}
